import type { FetchContext, FetchResponse } from 'ofetch'

type SuccessData<T> = {
  code: number
  data: T
}

type ErrorData<T = string> = {
  code: number
  err: T
}

type FetchResponseContext<T = any> = FetchContext<
  T,
  'blob' | 'text' | 'json' | 'arrayBuffer' | 'stream'
> & {
  response: FetchResponse<'basic' | 'cors' | 'default' | 'error' | 'opaque' | 'opaqueredirect'>
}

export type { ErrorData, FetchResponseContext, SuccessData }
